
  ___  ____  ____  ____  ____ (R)
 /__    /   ____/   /   ____/
___/   /   /___/   /   /___/   13.0   Copyright 1985-2013 StataCorp LP
  Statistics/Data Analysis            StataCorp
                                      4905 Lakeway Drive
     Special Edition                  College Station, Texas 77845 USA
                                      800-STATA-PC        http://www.stata.com
                                      979-696-4600        stata@stata.com
                                      979-696-4601 (fax)

16-user Stata network perpetual license:
       Serial number:  401306212364
         Licensed to:  Econometrics Laboratory
                       UC Berkeley

Notes:
      1.  (-v# option or -set maxvar-) 5000 maximum variables
      2.  Command line editing disabled
      3.  Stata running in batch mode

Note:  Your site can add messages to the introduction by editing the file
       stata.msg in the directory where Stata is installed.

. do evaluation_A1 

. ********************************
. * This file created table A1
. * Note: It can not use build.dta
. * because buuld.dta drops the 
. * counties in the ddoonut. 
. ********************************
. clear all

. set mem 4000m
set memory ignored.
    Memory no longer needs to be set in modern Statas; memory adjustments are
    performed on the fly automatically.

. set matsize 2000

. set maxvar 8000


. 
. 
. **************************
. * TVA DUMMIES
. **************************
. infile fips using ~/tva/data/tva_county_dummy/tvacounties.txt
(196 observations read)

. summ

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
        fips |       196    33855.66     15398.9       1015      51195

. g tva = 1

. sort fips

. save tmp, replace
(note: file tmp.dta not found)
file tmp.dta saved

. 
. ***************************
. * READ STATE-LEVEL DATA
. * AND TAKE 1930 INCOME VARIABLE
. ***************************
. u ~/tva/data/valentina/state_variables/state_level_data

. keep state pcp_income_30

. sort state

. save tmp7, replace
(note: file tmp7.dta not found)
file tmp7.dta saved

. 
. 
. ***************************
. * READ WAGE DATA
. * THESE DATA ARE THE
. * CORRECT MANUF AND TRADE WAGES.
. * IN TVA, WAGE DATA HAVE PROBLEMS
. * VALENTINA
. * FIXED THEM AND PUT IT IN TVA1
. ******************************
. u ~/tva/data/valentina/county_variables/new/tva1
(COUNTY & CITY DATA BOOK, 2000: Counties)

. keep fips mwage* pcmwage* pctwage* var88_county72 var89_county72

. duplicates report fips

Duplicates in terms of fips

--------------------------------------
   copies | observations       surplus
----------+---------------------------
        1 |         3130             0
        2 |            2             1
       88 |           88            87
--------------------------------------

. duplicates drop fips, force

Duplicates in terms of fips

(88 observations deleted)

. sort fips

. save tmp76, replace
(note: file tmp76.dta not found)
file tmp76.dta saved

. 
. 
. ***************************
. * READ COUNTY-LEVEL DATA
. ***************************
. u ~/tva/data/valentina/county_variables/tva_update //this file is built by tv
> a_update.do (certified by Valentina 7/14/2011)
(County and City Data Book [United States] Consolidated File: County Data, 1947
> -1)

. duplicates report fips

Duplicates in terms of fips

--------------------------------------
   copies | observations       surplus
----------+---------------------------
        1 |         2980             0
--------------------------------------

. drop mwage* twage*

. drop _merge

. sort fips

. merge 1:1 fips using tmp76

    Result                           # of obs.
    -----------------------------------------
    not matched                           152
        from master                         0  (_merge==1)
        from using                        152  (_merge==2)

    matched                             2,980  (_merge==3)
    -----------------------------------------

. tab _merge

                 _merge |      Freq.     Percent        Cum.
------------------------+-----------------------------------
         using only (2) |        152        4.85        4.85
            matched (3) |      2,980       95.15      100.00
------------------------+-----------------------------------
                  Total |      3,132      100.00

. keep if _merge ==3
(152 observations deleted)

. drop _merge

. 
. merge 1:1 fips using tmp

    Result                           # of obs.
    -----------------------------------------
    not matched                         2,796
        from master                     2,790  (_merge==1)
        from using                          6  (_merge==2)

    matched                               190  (_merge==3)
    -----------------------------------------

. tab _merge

                 _merge |      Freq.     Percent        Cum.
------------------------+-----------------------------------
        master only (1) |      2,790       93.44       93.44
         using only (2) |          6        0.20       93.64
            matched (3) |        190        6.36      100.00
------------------------+-----------------------------------
                  Total |      2,986      100.00

. drop if _merge ==2
(6 observations deleted)

. replace tva = 0 if tva ==.
(2790 real changes made)

. 
. ****************************
. *  Merge on Fishback Data  *
. ****************************
. 
. drop _merge

. drop if county==.|state==.
(6 observations deleted)

. 
. merge 1:1 county state using /accounts/projects/tva/tva/data/topography/fishb
> ack

    Result                           # of obs.
    -----------------------------------------
    not matched                           128
        from master                        27  (_merge==1)
        from using                        101  (_merge==2)

    matched                             2,947  (_merge==3)
    -----------------------------------------

. tab _merge

                 _merge |      Freq.     Percent        Cum.
------------------------+-----------------------------------
        master only (1) |         27        0.88        0.88
         using only (2) |        101        3.28        4.16
            matched (3) |      2,947       95.84      100.00
------------------------+-----------------------------------
                  Total |      3,075      100.00

. drop if _merge==2
(101 observations deleted)

. drop N10

. 
. ****************************
. *  Merge on Ag Land Values *
. ****************************
. drop _merge

. 
. merge 1:1 fips using /accounts/projects/tva/tva/data/agricultural_land/data

    Result                           # of obs.
    -----------------------------------------
    not matched                           229
        from master                         5  (_merge==1)
        from using                        224  (_merge==2)

    matched                             2,969  (_merge==3)
    -----------------------------------------

. 
. tab _merge

                 _merge |      Freq.     Percent        Cum.
------------------------+-----------------------------------
        master only (1) |          5        0.16        0.16
         using only (2) |        224        7.00        7.16
            matched (3) |      2,969       92.84      100.00
------------------------+-----------------------------------
                  Total |      3,198      100.00

. drop if _merge==2
(224 observations deleted)

. duplicates report fips

Duplicates in terms of fips

--------------------------------------
   copies | observations       surplus
----------+---------------------------
        1 |         2974             0
--------------------------------------

. 
. ****************************
. *  Merge on TVA 'Donut'    *
. ****************************
. drop _merge

. joinby fips using /accounts/projects/tva/tva/data/border_counties/donut, unma
> tched(both)

. tab _merge

                       _merge |      Freq.     Percent        Cum.
------------------------------+-----------------------------------
          only in master data |      2,889       97.04       97.04
           only in using data |          3        0.10       97.14
both in master and using data |         85        2.86      100.00
------------------------------+-----------------------------------
                        Total |      2,977      100.00

. drop if _merge==2
(3 observations deleted)

. 
. ****************************
. *  Merge on fata with neighbors of neighbors
. ****************************
. drop _merge

. joinby fips using /accounts/projects/tva/tva/data/border_counties/neighbors_o
> f_neighbors/donut2, unmatched(both)

. tab _merge

                       _merge |      Freq.     Percent        Cum.
------------------------------+-----------------------------------
          only in master data |          5        0.16        0.16
           only in using data |        173        5.50        5.66
both in master and using data |      2,969       94.34      100.00
------------------------------+-----------------------------------
                        Total |      3,147      100.00

. drop if _merge==2
(173 observations deleted)

. 
. 
. 
. ****************************
. *  Merge on Employment     *
. ****************************
. drop _merge 

. merge 1:1 fips using ~/tva/data/valentina/county_variables/enrico/enrico_jobs

    Result                           # of obs.
    -----------------------------------------
    not matched                            82
        from master                         0  (_merge==1)
        from using                         82  (_merge==2)

    matched                             2,974  (_merge==3)
    -----------------------------------------

. 
. tab _merge

                 _merge |      Freq.     Percent        Cum.
------------------------+-----------------------------------
         using only (2) |         82        2.68        2.68
            matched (3) |      2,974       97.32      100.00
------------------------+-----------------------------------
                  Total |      3,056      100.00

. drop if _merge==2
(82 observations deleted)

. duplicates report fips

Duplicates in terms of fips

--------------------------------------
   copies | observations       surplus
----------+---------------------------
        1 |         2974             0
--------------------------------------

. 
. 
. *******************************
. *  Merge on Housing Val/Rents *
. *******************************
. 
. drop _merge 

. merge 1:1 fips using ~/tva/data/valentina/county_variables/RawData/housingval
> s

    Result                           # of obs.
    -----------------------------------------
    not matched                           192
        from master                         1  (_merge==1)
        from using                        191  (_merge==2)

    matched                             2,973  (_merge==3)
    -----------------------------------------

. 
. tab _merge

                 _merge |      Freq.     Percent        Cum.
------------------------+-----------------------------------
        master only (1) |          1        0.03        0.03
         using only (2) |        191        6.03        6.07
            matched (3) |      2,973       93.93      100.00
------------------------+-----------------------------------
                  Total |      3,165      100.00

. drop if _merge==2
(191 observations deleted)

. duplicates report fips

Duplicates in terms of fips

--------------------------------------
   copies | observations       surplus
----------+---------------------------
        1 |         2974             0
--------------------------------------

. 
. 
. drop _merge 

. merge 1:1 fips using ~/tva/data/valentina/county_variables/RawData/county62_1
> , keepusing(var61_county62 var63_county62)

    Result                           # of obs.
    -----------------------------------------
    not matched                           215
        from master                         2  (_merge==1)
        from using                        213  (_merge==2)

    matched                             2,972  (_merge==3)
    -----------------------------------------

. 
. ren var61_county62 medhsval60

. ren var63_county62 medrnt60

. tab _merge

                 _merge |      Freq.     Percent        Cum.
------------------------+-----------------------------------
        master only (1) |          2        0.06        0.06
         using only (2) |        213        6.68        6.75
            matched (3) |      2,972       93.25      100.00
------------------------+-----------------------------------
                  Total |      3,187      100.00

. drop if _merge==2
(213 observations deleted)

. duplicates report fips

Duplicates in terms of fips

--------------------------------------
   copies | observations       surplus
----------+---------------------------
        1 |         2974             0
--------------------------------------

. 
. 
. 
. *******************************
. *  Merge on 1890 Vars         *
. *******************************
. 
. drop _merge 

. merge 1:1 fips using ~/tva/data/valentina/county_variables/1890/data.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                           178
        from master                         1  (_merge==1)
        from using                        177  (_merge==2)

    matched                             2,973  (_merge==3)
    -----------------------------------------

. 
. tab _merge

                 _merge |      Freq.     Percent        Cum.
------------------------+-----------------------------------
        master only (1) |          1        0.03        0.03
         using only (2) |        177        5.62        5.65
            matched (3) |      2,973       94.35      100.00
------------------------+-----------------------------------
                  Total |      3,151      100.00

. drop if _merge==2
(177 observations deleted)

. duplicates report fips

Duplicates in terms of fips

--------------------------------------
   copies | observations       surplus
----------+---------------------------
        1 |         2974             0
--------------------------------------

. 
. 
. *******************************
. * Merge on weather variables  *
. *******************************
. drop _merge

. 
. merge 1:1 fips using /accounts/projects/tva/tva/data/weather/JUL_MEAN_IDW200_
> 365_1968_2002.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                           145
        from master                         6  (_merge==1)
        from using                        139  (_merge==2)

    matched                             2,968  (_merge==3)
    -----------------------------------------

. foreach var of varlist tmin tmean tmax{
  2.         ren `var' `var'_jul
  3. }

. drop if _merge==2
(139 observations deleted)

. drop _merge

. 
. merge 1:1 fips using /accounts/projects/tva/tva/data/weather/JAN_MEAN_IDW200_
> 365_1968_2002.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                           145
        from master                         6  (_merge==1)
        from using                        139  (_merge==2)

    matched                             2,968  (_merge==3)
    -----------------------------------------

. foreach var of varlist tmin tmean tmax{
  2.         ren `var' `var'_jan
  3. }

. drop if _merge==2
(139 observations deleted)

. 
. 
. 
. 
. ****************************
. *  Cleanup and Definition  *
. ****************************
. 
. * State and region
. drop state

. g state = int(fips/1000)

. drop if state ==51 | state ==52 | state ==2 | state ==3 | state ==15
(0 observations deleted)

. g northeast =0

. g midwest=0

. g south=0

. g west=0

. replace northeast =1 if state == 9 | state == 23 | state == 25 | state == 33 
> | state == 44 | state  == 50 | state == 34 | state == 36 | state == 42
(217 real changes made)

. replace midwest=1    if state == 17 | state == 18 | state == 26 | state == 39
>  | state == 55 | state ==19 | state == 20 | state == 27 | state == 29 | state
>  == 31 | state == 38 | state == 46
(1056 real changes made)

. replace south=1      if state ==10 | state == 11 | state == 12 | state == 13 
> | state == 24 | state  == 37 | state == 45 | state == 51   | state == 54 | st
> ate == 1 | state == 21 | state == 28  | state == 47 | state == 5 | state == 2
> 2 | state == 40 | state == 48
(1289 real changes made)

. replace west=1       if state == 4 | state == 8 | state == 16 | state == 30 |
>  state == 32 | state == 35 | state == 49 | state == 56 | state == 2 | state =
> = 6 | state == 15 | state == 41 | state ==53
(412 real changes made)

. g       region =1 if northeast ==1
(2757 missing values generated)

. replace region =2 if midwest ==1
(1056 real changes made)

. replace region =3 if south ==1
(1289 real changes made)

. replace region =4 if west ==1
(412 real changes made)

. 
. * CPI
. g cpi890= 5 //need to get an official number here

. g cpi0  = 7 

. g cpi10 = 9 

. g cpi20 = 20

. g cpi30 = 16.7

. g cpi40 = 14

. g cpi50 = 24.1

. g cpi60 = 29.6

. g cpi70 = 38.8

. g cpi80 = 82.4

. g cpi90 = 130.7

. g cpi2000 = 172.2

. 
. 
. * Merge the state-level variable
. drop _merge

. sort state

. merge state using tmp7
(note: you are using old merge syntax; see [D] merge for new syntax)
variable state does not uniquely identify observations in the master data

. tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          2 |         12        0.40        0.40
          3 |      2,974       99.60      100.00
------------+-----------------------------------
      Total |      2,986      100.00

. drop if tva ==.
(12 observations deleted)

. rm tmp.dta

. rm tmp7.dta

. rm tmp76.dta

. 
. ***********************************************
. *Drop Donut and counties with missing lat/long*
. ***********************************************
. * XXXXXX
. ** drop if border_county==1|latitude==.|longitud==. 
. tab border_county

border_coun |
         ty |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |         85      100.00      100.00
------------+-----------------------------------
      Total |         85      100.00

. drop if latitude==.|longitud==.
(27 observations deleted)

. 
. 
. *******************************************************
. * Drop counties with very low populations in any year *
. *******************************************************
. 
. drop if pop0<1000|pop10<1000|pop20<1000|pop30<1000|pop40<1000|pop50<1000|pop6
> 0<1000|pop70<1000|pop80<1000|pop90<1000|pop2000<1000
(99 observations deleted)

. 
. 
. 
. ********************************
. * NEW VARIABLES
. ********************************
. 
. * Per capita wage in manufacturing, in real dollars
. * Manufacturing payroll of production workers over average number of producti
> on workers 
. g wage890    = (mwage890)/(cpi890/100)
(504 missing values generated)

. g wage0    = (pcmwage00)/(cpi0/100)
(299 missing values generated)

. g wage20   = (pcmwage20)/(cpi20/100)
(138 missing values generated)

. g wage30   = (pcmwage30)/(cpi30/100)
(434 missing values generated)

. g wage40   = (pcmwage39)/(cpi40/100)
(633 missing values generated)

. g wage50   = (pcmwage47)/(cpi50/100)
(491 missing values generated)

. g wage60   = (pcmwage58)/(cpi60/100)
(421 missing values generated)

. g wage70   = (pcmwage67)/(cpi70/100)
(707 missing values generated)

. g wage80   = (pcmwage82)/(cpi80/100)
(590 missing values generated)

. g wage90   = (pcmwage87)/(cpi90/100)
(673 missing values generated)

. g wage2000 = (pcmwage97)/(cpi2000/100)
(980 missing values generated)

. 
. 
. * Average manufacturing wages of production workers
. g prodwage40=manuf_prod_wages39/manuf_prod39
(471 missing values generated)

. g prodwage50=manuf_prod_wages47/manuf_prod47
(460 missing values generated)

. g prodwage60=manuf_prod_wages58/manuf_prod58
(242 missing values generated)

. g prodwage70=manuf_prod_wages67/manuf_prod67
(840 missing values generated)

. g prodwage90=manuf_prod_wages87/manuf_prod87
(768 missing values generated)

. g prodwage2000=manuf_prod_wages97/manuf_prod97
(1183 missing values generated)

. 
. summ wage*, detail

                           wage890
-------------------------------------------------------------
      Percentiles      Smallest
 1%     2669.474       1155.456
 5%     3812.673        1209.74
10%         4445       1311.111       Obs                2344
25%     6101.715        1508.41       Sum of Wgt.        2344

50%     8600.608                      Mean           9218.586
                        Largest       Std. Dev.      4566.678
75%     11486.41          43000
90%      14067.5       49012.32       Variance       2.09e+07
95%     16519.13          57160       Skewness       2.600022
99%     24863.48          58420       Kurtosis       20.54098

                            wage0
-------------------------------------------------------------
      Percentiles      Smallest
 1%     1.983019       1.109524
 5%     2.411486       1.344015
10%     2.792085       1.428571       Obs                2549
25%     3.963454       1.448214       Sum of Wgt.        2549

50%     5.192532                      Mean           5.156684
                        Largest       Std. Dev.      1.755429
75%     6.141038         12.575
90%     7.178585       13.29898       Variance        3.08153
95%     8.087376       15.01858       Skewness       .6522588
99%      10.2619       17.45605       Kurtosis       4.909014

                           wage20
-------------------------------------------------------------
      Percentiles      Smallest
 1%     2.318945            1.2
 5%     2.941273           1.35
10%     3.262858       1.691018       Obs                2710
25%     3.906163       1.692962       Sum of Wgt.        2710

50%     4.800372                      Mean           4.921439
                        Largest       Std. Dev.      1.398219
75%     5.783058        11.2125
90%     6.784475       11.68573       Variance       1.955015
95%     7.372916       14.43822       Skewness       .7572621
99%     8.586093       15.34602       Kurtosis       5.008197

                           wage30
-------------------------------------------------------------
      Percentiles      Smallest
 1%     2.326462       1.760061
 5%     2.946208       1.778443
10%     3.443651       1.784279       Obs                2414
25%     4.493787       1.796706       Sum of Wgt.        2414

50%     6.169794                      Mean           6.098053
                        Largest       Std. Dev.      1.986435
75%     7.562191       11.90906
90%     8.651052       11.94494       Variance       3.945923
95%     9.297255       12.77114       Skewness        .090199
99%     10.58084       13.74501       Kurtosis       2.389065

                           wage40
-------------------------------------------------------------
      Percentiles      Smallest
 1%     2.218651       1.046393
 5%     2.950543       1.099793
10%     3.419717       1.322403       Obs                2215
25%     4.379776       1.362857       Sum of Wgt.        2215

50%       5.7977                      Mean           5.946812
                        Largest       Std. Dev.      2.038302
75%      7.32742       12.03095
90%     8.776724          12.45       Variance       4.154675
95%     9.618739       12.76308       Skewness       .3736719
99%     10.86343       12.78559       Kurtosis       2.649626

                           wage50
-------------------------------------------------------------
      Percentiles      Smallest
 1%     3.526971       2.161134
 5%     4.552642       2.390402
10%     5.106926       2.489627       Obs                2357
25%     6.166247        2.57081       Sum of Wgt.        2357

50%     7.676349                      Mean           7.889083
                        Largest       Std. Dev.       2.25444
75%     9.442885       14.62174
90%     11.01925       14.89074       Variance       5.082502
95%     11.83936       15.21497       Skewness       .3192851
99%     13.22828       15.24044       Kurtosis         2.5424

                           wage60
-------------------------------------------------------------
      Percentiles      Smallest
 1%      4.55741       .8445946
 5%     6.129344        3.16723
10%     6.881882       3.185328       Obs                2427
25%     8.279113       3.589527       Sum of Wgt.        2427

50%     10.52248                      Mean           10.88086
                        Largest       Std. Dev.      3.352349
75%     13.31432       20.60223
90%     15.63033        20.7529       Variance       11.23824
95%     16.68982        21.7382       Skewness        .368728
99%     18.78605       23.88181       Kurtosis       2.545678

                           wage70
-------------------------------------------------------------
      Percentiles      Smallest
 1%     5.154639        2.57732
 5%     7.216495        2.57732
10%     7.731959        2.57732       Obs                2141
25%     9.342784       3.865979       Sum of Wgt.        2141

50%     11.49881                      Mean           11.89519
                        Largest       Std. Dev.       3.33924
75%      14.3299       21.69331
90%     16.49485       21.90722       Variance       11.15052
95%     17.72457       23.01178       Skewness       .3215296
99%     19.75945       23.60591       Kurtosis       2.625554

                           wage80
-------------------------------------------------------------
      Percentiles      Smallest
 1%     7.281553       3.640777
 5%     9.708737       4.854369
10%     10.85491       4.854369       Obs                2258
25%     12.96746       4.854369       Sum of Wgt.        2258

50%     16.10057                      Mean           16.65774
                        Largest       Std. Dev.      5.039956
75%     19.82201       33.98058
90%     23.50225       33.98058       Variance       25.40115
95%     25.61635       35.66977       Skewness       .5651975
99%     30.51317        35.7371       Kurtosis       3.282737

                           wage90
-------------------------------------------------------------
      Percentiles      Smallest
 1%     5.355777       1.042464
 5%     7.268554       3.825555
10%     8.416221       3.825555       Obs                2175
25%     10.24583       3.825555       Sum of Wgt.        2175

50%     12.66259                      Mean           13.01985
                        Largest       Std. Dev.      3.911711
75%      15.4503       27.45446
90%     18.05143       27.71788       Variance       15.30149
95%     19.80787       27.92006       Skewness       .5666178
99%     24.56856       29.83933       Kurtosis        3.67519

                          wage2000
-------------------------------------------------------------
      Percentiles      Smallest
 1%     7.318419       5.363767
 5%     9.235471       5.600044
10%     10.18947       5.605347       Obs                1868
25%     11.82342       5.878808       Sum of Wgt.        1868

50%     13.88961                      Mean           14.37492
                        Largest       Std. Dev.      3.789183
75%     16.35051       32.51498
90%     18.98883       32.53788       Variance       14.35791
95%     21.10215       33.18069       Skewness       1.053213
99%     26.42283       33.88249       Kurtosis       5.308537

. summ prodwage*, detail

                         prodwage40
-------------------------------------------------------------
      Percentiles      Smallest
 1%            0              0
 5%            0              0
10%            0              0       Obs                2377
25%     5.511253              0       Sum of Wgt.        2377

50%     7.961777                      Mean            8.32018
                        Largest       Std. Dev.      13.93655
75%     10.62067       84.55329
90%     12.93736       94.62972       Variance       194.2274
95%     14.56276       99.67664       Skewness       37.53755
99%     19.25247        628.994       Kurtosis       1658.469

                         prodwage50
-------------------------------------------------------------
      Percentiles      Smallest
 1%            0              0
 5%            0              0
10%            0              0       Obs                2388
25%     9.511823              0       Sum of Wgt.        2388

50%     12.50838                      Mean           12.12766
                        Largest       Std. Dev.      5.725635
75%     15.78185       25.17864
90%     18.62704       25.64185       Variance        32.7829
95%     20.04891       26.24403       Skewness       .5662856
99%     22.32578       92.58605       Kurtosis       19.09879

                         prodwage60
-------------------------------------------------------------
      Percentiles      Smallest
 1%            0              0
 5%            0              0
10%     6.753727              0       Obs                2606
25%     12.97345              0       Sum of Wgt.        2606

50%      17.1485                      Mean           16.88914
                        Largest       Std. Dev.      7.776357
75%     22.03695       35.47704
90%     26.55544       35.73648       Variance       60.47173
95%     28.36118       37.43317       Skewness      -.4988277
99%     32.11253       41.12448       Kurtosis       3.134644

                         prodwage70
-------------------------------------------------------------
      Percentiles      Smallest
 1%     8.876288       4.438144
 5%      12.4268       4.438144
10%     13.31443       4.438144       Obs                2008
25%     16.10287       7.396907       Sum of Wgt.        2008

50%     19.76992                      Mean           20.45467
                        Largest       Std. Dev.      5.722891
75%     24.60601       36.61469
90%     28.40413       36.73797       Variance       32.75148
95%     30.47045       39.62629       Skewness       .3261488
99%     33.84085       40.64937       Kurtosis       2.619114

                         prodwage90
-------------------------------------------------------------
      Percentiles      Smallest
 1%     9.222647       6.587605
 5%     12.51645       6.587605
10%     14.49273       6.587605       Obs                2080
25%     17.70073       6.587605       Sum of Wgt.        2080

50%     21.86597                      Mean           22.45829
                        Largest       Std. Dev.      6.659989
75%     26.66098       47.27658
90%      31.0872       47.73019       Variance       44.35545
95%     33.99204       48.07835       Skewness       .5190434
99%     41.82188       51.38332       Kurtosis       3.539238

                        prodwage2000
-------------------------------------------------------------
      Percentiles      Smallest
 1%     12.96384       9.236406
 5%     16.02993       9.643275
10%     17.69516       9.652407       Obs                1665
25%     20.49484       10.12331       Sum of Wgt.        1665

50%     24.13977                      Mean           24.85532
                        Largest       Std. Dev.      6.374906
75%      28.1779       50.75711
90%      32.7367       50.81316       Variance       40.63943
95%     36.13955       54.89677       Skewness       .9102342
99%     45.04201       57.13716       Kurtosis       4.700885

. correlate wage40 prodwage40
(obs=2093)

             |   wage40 prodw~40
-------------+------------------
      wage40 |   1.0000
  prodwage40 |   0.2474   1.0000


. correlate wage50 prodwage50
(obs=2142)

             |   wage50 prodw~50
-------------+------------------
      wage50 |   1.0000
  prodwage50 |   0.9079   1.0000


. correlate wage60 prodwage60
(obs=2354)

             |   wage60 prodw~60
-------------+------------------
      wage60 |   1.0000
  prodwage60 |   1.0000   1.0000


. correlate wage70 prodwage70
(obs=2008)

             |   wage70 prodw~70
-------------+------------------
      wage70 |   1.0000
  prodwage70 |   1.0000   1.0000


. 
. 
. g Dwage30 = log(wage30)- log(wage20)
(491 missing values generated)

. g Dwage40 = log(wage40)-log(wage30)
(753 missing values generated)

. g Dwage50 = log(wage50)-log(wage40)
(787 missing values generated)

. g Dwage60 = log(wage60)-log(wage50)
(653 missing values generated)

. g Dwage70 = log(wage70)-log(wage60)
(782 missing values generated)

. 
. g Dprod60 = log(prodwage60) - log(prodwage50)
(887 missing values generated)

. g Dprod70 = log(prodwage70) - log(prodwage60)
(939 missing values generated)

. g Dprod90 = log(prodwage90) - log(prodwage2000)
(1327 missing values generated)

. 
. summ Dwage*, detail

                           Dwage30
-------------------------------------------------------------
      Percentiles      Smallest
 1%    -.4918324      -.9598316
 5%    -.2505151      -.9566965
10%    -.1164592      -.8791418       Obs                2357
25%      .063111      -.8354542       Sum of Wgt.        2357

50%      .231919                      Mean           .2000362
                        Largest       Std. Dev.      .2459239
75%     .3588036       .9818246
90%     .4680053       .9934299       Variance       .0604786
95%     .5533749       .9971423       Skewness      -.6036898
99%     .7505719       1.016949       Kurtosis       4.479572

                           Dwage40
-------------------------------------------------------------
      Percentiles      Smallest
 1%    -.7560138      -1.507389
 5%    -.4356588      -1.036492
10%    -.3294816      -1.035437       Obs                2095
25%    -.1619117      -1.026863       Sum of Wgt.        2095

50%    -.0146277                      Mean          -.0378365
                        Largest       Std. Dev.      .2317175
75%     .1105421       .7165899
90%     .2190892       .7414824       Variance        .053693
95%     .2773533       .7749587       Skewness      -.6723422
99%     .4669921       1.175999       Kurtosis       5.406347

                           Dwage50
-------------------------------------------------------------
      Percentiles      Smallest
 1%    -.2360939       -1.36199
 5%     .0128643      -.9492155
10%     .0985957       -.497751       Obs                2061
25%     .1978561      -.4845876       Sum of Wgt.        2061

50%     .3117245                      Mean           .3203679
                        Largest       Std. Dev.      .2110942
75%     .4372303       1.198185
90%     .5691231       1.241305       Variance       .0445607
95%     .6571792       1.436537       Skewness      -.0078887
99%     .8968775       1.511233       Kurtosis       7.500843

                           Dwage60
-------------------------------------------------------------
      Percentiles      Smallest
 1%    -.2055625      -.8012342
 5%     .0210916      -.7748476
10%     .1015398      -.5420805       Obs                2195
25%     .2171423      -.5240162       Sum of Wgt.        2195

50%       .31713                      Mean           .3177268
                        Largest       Std. Dev.      .1930937
75%     .4176884       1.260561
90%     .5365978       1.273532       Variance       .0372852
95%     .6159146       1.283195       Skewness       .0392072
99%     .8426484       1.370964       Kurtosis       6.856991

                           Dwage70
-------------------------------------------------------------
      Percentiles      Smallest
 1%    -.5989936      -1.441829
 5%    -.2321656      -1.040754
10%    -.1130724      -.9015508       Obs                2066
25%    -.0001875      -.8624406       Sum of Wgt.        2066

50%     .0744553                      Mean           .0749921
                        Largest       Std. Dev.      .1968983
75%      .167097       .7805124
90%     .2819334       1.022744       Variance       .0387689
95%     .3751807       1.047737       Skewness      -.6443667
99%     .5981784       1.149171       Kurtosis       8.979301

. summ Dprod*, detail

                           Dprod60
-------------------------------------------------------------
      Percentiles      Smallest
 1%    -.2055626      -1.643564
 5%     .0218025      -.5420805
10%     .1007762      -.5240162       Obs                1961
25%     .2180013      -.4806261       Sum of Wgt.        1961

50%     .3188193                      Mean           .3188943
                        Largest       Std. Dev.      .2017266
75%     .4175569       1.273532
90%     .5369114       1.283195       Variance       .0406936
95%     .6183358       1.370964       Skewness       .4260164
99%      .832618       2.630852       Kurtosis       18.19438

                           Dprod70
-------------------------------------------------------------
      Percentiles      Smallest
 1%    -.5654453      -1.441829
 5%    -.2259291      -1.040754
10%    -.1110638      -.9015508       Obs                1909
25%     .0020046      -.8624406       Sum of Wgt.        1909

50%     .0751277                      Mean           .0775987
                        Largest       Std. Dev.      .1956174
75%     .1676215       .7805123
90%     .2831941       1.022744       Variance       .0382662
95%     .3788263       1.047737       Skewness      -.5934794
99%     .5981783       1.149171       Kurtosis        9.15522

                           Dprod90
-------------------------------------------------------------
      Percentiles      Smallest
 1%    -.5026799      -1.062501
 5%    -.2915003      -.8920207
10%    -.2203453      -.8854595       Obs                1521
25%    -.1360014      -.6653883       Sum of Wgt.        1521

50%    -.0562092                      Mean          -.0579649
                        Largest       Std. Dev.      .1515576
75%     .0208748       .5348957
90%     .1047876       .5562664       Variance       .0229697
95%      .181293        .573494       Skewness      -.2622844
99%     .3753098       .6504066       Kurtosis       7.115682

. 
. correlate Dwage60 Dprod60
(obs=1961)

             |  Dwage60  Dprod60
-------------+------------------
     Dwage60 |   1.0000
     Dprod60 |   0.9385   1.0000


. correlate Dwage70 Dprod70
(obs=1909)

             |  Dwage70  Dprod70
-------------+------------------
     Dwage70 |   1.0000
     Dprod70 |   1.0000   1.0000


. 
. 
. 
. 
. * Per capita wage in trade, in real dollars
. * total payroll in wholesale establishments + retail establishments / (total 
> workers in retail+ in wholsale)
. g twage30  = pctwage30/(cpi30/100) 
(157 missing values generated)

. g twage40  = pctwage40/(cpi40/100)
(162 missing values generated)

. g twage50  = pctwage54/(cpi50/100)
(603 missing values generated)

. g twage60  = pctwage63/(cpi60/100)
(130 missing values generated)

. g twage70  = pctwage72/(cpi70/100)
(101 missing values generated)

. g twage80  = pctwage82/(cpi80/100)
(179 missing values generated)

. g twage90  = pctwage87/(cpi90/100)
(278 missing values generated)

. g twage2000  = pctwage97/(cpi2000/100)
(639 missing values generated)

. 
. * Agricultural values
. 
. g lnfaval890 = ln(faval890/(cpi890/100))
(481 missing values generated)

. g lnfaval0 = ln(faval900/(cpi0/100))
(293 missing values generated)

. g lnfaval10 = ln(faval910/(cpi10/100))
(130 missing values generated)

. g lnfaval20 = ln(faval920/(cpi20/100))
(30 missing values generated)

. g lnfaval30 = ln(faval930/(cpi30/100))
(4 missing values generated)

. g lnfaval40 = ln(faval940/(cpi40/100))
(4 missing values generated)

. g lnfaval50 = ln(faval950/(cpi50/100))
(4 missing values generated)

. g lnfaval60 = ln(faval959/(cpi60/100))
(5 missing values generated)

. g lnfaval70 = ln(faval1969/(cpi70/100))
(16 missing values generated)

. g lnfaval80 = ln(faval1982/(cpi80/100))
(16 missing values generated)

. g lnfaval90 = ln(faval1992/(cpi90/100))
(19 missing values generated)

. g lnfaval2000=ln(faval2002/(cpi2000/100))
(6 missing values generated)

. 
. 
. * Median family income
. gen lnmedfaminc50  = ln(medfaminc50/(cpi50/100)) 
(17 missing values generated)

. gen lnmedfaminc60  = ln(medfaminc60/(cpi60/100)) 

. gen lnmedfaminc70  = ln(medfaminc70/(cpi70/100)) 
(1 missing value generated)

. gen lnmedfaminc80  = ln(medfaminc80/(cpi80/100)) 
(1 missing value generated)

. gen lnmedfaminc90  = ln(medfaminc80/(cpi90/100)) 
(1 missing value generated)

. gen lnmedfaminc2000= ln(medfaminc2000/(cpi2000/100))
(2 missing values generated)

. 
. * Farm production
. gen lnvfprod30   = log(vfprod30/(cpi30/100))
(1 missing value generated)

. gen lnvfprod40   = log(vfprod40/(cpi40/100))

. gen lnvfprod50   = log(vfprod50/(cpi50/100))

. gen lnvfprod60   = log(vfprod60/(cpi60/100))

. gen lnvfprod70   = log(vfprod70/(cpi70/100))

. gen lnvfprod80   = log(vfprod80/(cpi80/100))
(41 missing values generated)

. gen lnvfprod90   = log(vfprod90/(cpi90/100))
(26 missing values generated)

. gen lnvfprod2000 = log(vfprod2000/(cpi2000/100))
(7 missing values generated)

. 
. *Foreign born
. gen fb0=fbwmtot00 + fbwftot00 
(252 missing values generated)

. gen fb10=fbwtot10
(130 missing values generated)

. gen fb20=fbwmtot20 + fbwftot20 
(26 missing values generated)

. gen fb30=fbwmtot + fbwftot

. 
. gen fbshr20=fb20/(wmtot20 + wftot20)
(26 missing values generated)

. gen fbshr30=fb30/(wmtot + wftot)

. 
. *Housing Values/Rents
. *ren medval medhsval30
. *ren medrent medrnt30 //different definition of rent
. 
. ren medrnt30_NHGIS medrnt30

. ren medhsval30_NHGIS medhsval30

. ren var88_county72 medhsval70

. ren var89_county72 medrnt70

. 
. foreach var in medhsval medrnt{
  2.         foreach yr in 30 40 50 60 70 80 90 2000{
  3.                 cap replace `var'`yr'=`var'`yr'/(cpi`yr'/100)
  4.         }
  5. }

. 
. *various
. drop other60

. 
. *drop counties experiencing big changes in area
. gen d=(b1_lnd01_county00 - area)/(b1_lnd01_county00 + area)/2

. drop if abs(d)>.03
(95 observations deleted)

. replace area=(b1_lnd01_county00 + area)/2
area was long now double
(2657 real changes made)

. 
. 
. 
. ******************************
. * standardize variable names *
. ******************************
. 
. 
. ren emp00 emp0

. ren manuf_jobs_00 manuf_jobs_0

. 
. foreach yr in 0 10 20 30 40 50 60 70 80 90 2000{
  2.         cap drop manuf`yr'
  3.         cap drop agr`yr'
  4.         ren manuf_jobs_`yr' manuf`yr'
  5.         cap ren ag_jobs`yr' agr`yr'
  6. }

. ren manuf_jobs890 manuf890

. 
. 
. 
. foreach yr in 0 10 20 30 60 80 90 2000{
  2.         gen other`yr'=emp`yr'-agr`yr'-manuf`yr'
  3. }
(237 missing values generated)
(121 missing values generated)
(27 missing values generated)
(5 missing values generated)
(1 missing value generated)
(1 missing value generated)
(2 missing values generated)

. 
. 
. *********************
. *    Make Share     *
. *********************
. 
. foreach var in manuf agr{
  2.         foreach yr in 0 10 20 30 40 50 60 70 80 90 2000{
  3.                 cap gen `var'shr`yr'=`var'`yr'/emp`yr'
  4.         }
  5. }

. 
. ********************
. * prepare outcomes *
. ********************
. 
. foreach var in pop emp house wage twage agr manuf other medhsval medrnt fb pr
> odwage{
  2.         cap gen ln`var'890=ln(`var'890)
  3.         cap gen ln`var'0=ln(`var'0)
  4.         cap gen ln`var'10=ln(`var'10)
  5.         cap gen ln`var'20=ln(`var'20)
  6.         cap gen ln`var'30=ln(`var'30)
  7.         cap gen ln`var'40=ln(`var'40)
  8.         cap gen ln`var'50=ln(`var'50)
  9.         cap gen ln`var'60=ln(`var'60)
 10.         cap gen ln`var'70=ln(`var'70)
 11.         cap gen ln`var'80=ln(`var'80)
 12.         cap gen ln`var'90=ln(`var'90)
 13.         cap gen ln`var'2000=ln(`var'2000)
 14. }

. 
. drop lntwage20  lnmedhsval20 lnmedrnt20 //stata confuses 20 and 2000

. 
. 
. *******************
. *Generate Controls*
. *******************
. g urbshare0=popurb0/pop0
(234 missing values generated)

. g urbshare10=popurb10/pop10
(124 missing values generated)

. g urbshare20=popurb20/pop20
(24 missing values generated)

. g urbshare30=popurb30/pop20
(24 missing values generated)

. gen popdens0=pop0/b1_lnd01_county00
(234 missing values generated)

. 
. 
. *fix zeros in covariate quantities
. 
. foreach var in agr manuf other{
  2.         foreach yr in 10 20 30{
  3.                 cap replace ln`var'`yr'=0 if `var'`yr'<=0
  4.                 gen no`var'`yr'dum=`var'`yr'<=0
  5.         }
  6. }

. 
. ren mfgcap00 mfgcap0

. gen lnmfgcap0=ln(mfgcap0)
(274 missing values generated)

. replace lnmfgcap0=0 if mfgcap0==0
(7 real changes made)

. 
. 
. 
. *fix wages
. 
. foreach var in wage twage{
  2.         foreach yr in 20 30{
  3.                 cap replace ln`var'`yr'=-1 if `var'`yr'==.
  4.                 cap gen no`var'`yr'dum=`var'`yr'==.
  5.         }
  6. }

. 
. 
. 
. *transformations
. foreach var of varlist elevmax elevrang popdens0 tillit10 tillit1020 tillit10
> 10 retsales radiorep totunemp area{
  2.         gen ln`var'=ln(`var')
  3. }
(234 missing values generated)
(24 missing values generated)
(119 missing values generated)
(1 missing value generated)
(7 missing values generated)

. 
. 
. center tmean* lnelevmax

. 
. foreach var of varlist c_lnelevmax white0 white20 white30 c_tmean* lnmanuf0 l
> nmanuf10 lnmanuf20 lnradiorep lnemp20 lnemp30 lnwage0 lnwage20 lnwage30 lntwa
> ge30 lnpop0 lnpop20 lnpop30 lnfaval0 lnfaval20 lnfaval30 tmean*{
  2.         gen `var'sq=`var'^2
  3.         gen `var'cub=`var'^3
  4. }
(234 missing values generated)
(234 missing values generated)
(24 missing values generated)
(24 missing values generated)
(925 missing values generated)
(925 missing values generated)
(121 missing values generated)
(121 missing values generated)
(27 missing values generated)
(27 missing values generated)
(1 missing value generated)
(1 missing value generated)
(27 missing values generated)
(27 missing values generated)
(278 missing values generated)
(278 missing values generated)
(234 missing values generated)
(234 missing values generated)
(24 missing values generated)
(24 missing values generated)
(275 missing values generated)
(275 missing values generated)
(28 missing values generated)
(28 missing values generated)
(4 missing values generated)
(4 missing values generated)

. 
. gen popdifsq=(lnpop30-lnpop20)^2
(24 missing values generated)

. gen empdifsq=(lnemp30-lnemp20)^2
(27 missing values generated)

. gen manufdifsq=(lnmanuf20-lnmanuf0)^2
(925 missing values generated)

. gen urbsharedifsq=(urbshare20-urbshare0)^2
(234 missing values generated)

. gen whitedifsq=(white20-white0)^2
(234 missing values generated)

. gen agrdifsq=(lnagr20-lnagr0)^2
(256 missing values generated)

. gen wagedifsq=(lnwage20-lnwage0)^2
(278 missing values generated)

. gen favaldifsq=(lnfaval20-lnfaval0)^2
(275 missing values generated)

. 
. gen agrshr30sq=agrshr30^2
(5 missing values generated)

. gen agrshr20sq=agrshr20^2
(27 missing values generated)

. 
. gen lnagr20sq=lnagr20^2
(27 missing values generated)

. gen lnagr0sq=lnagr0^2
(256 missing values generated)

. gen fbdifsq=(lnfb20-lnfb0)^2
(254 missing values generated)

. 
. gen wagedif2sq=(lnwage30-lnwage20)^2

. gen tmean_jan_jul=tmean_jan*tmean_jul

. 
. gen pctil20=tillit1020/t10tot20
(24 missing values generated)

. gen pctil30=tillit10/t10tot

. replace PRADIO=PRADIO/100
(2752 real changes made)

. gen urate30=totunemp/(totunemp+emp30)

. 
. 
. global X "lnelevmax lnelevrang lnarea lnpop20 lnpop20sq lnpop30 lnpop30sq pop
> difsq agrshr20 agrshr20sq agrshr30 agrshr30sq manufshr20 manufshr30 nowage20 
> nowage30 lnwage20 lnwage30 notwage30 lntwage30 lnemp20 lnemp30 urbshare20 urb
> share30 lnfaval20 lnfaval30 lnmedhsval30 lnmedrnt30 white20 white20sq white30
>  white30sq pctil20 pctil30 PRADIO urate30 fbshr20 fbshr30"

. *c_lnelevmax* lnelevrang 
. 
. 
. run "~/geo/x_ols_JP_v10.ado" //use Juan Pablo's version of Conley (1999)

. run "~/geo/bo2_JP.ado" //use Juan Pablo's version of O-B

. global tables="tables"

. 
. 
. *******************************************
. *******************************************
. * Propensity score 
. *******************************************
. *******************************************
. 
. sum $X

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
   lnelevmax |      2753    7.182528    1.123009   2.833213   9.581491
  lnelevrang |      2753    6.479897    1.266195    2.70805   9.592332
      lnarea |      2753    6.539267    .7319343   3.198673   9.909171
     lnpop20 |      2729     9.85701    .9137307   6.940222   14.93164
   lnpop20sq |      2729    97.99524    18.60716   48.16668   222.9539
-------------+--------------------------------------------------------
     lnpop30 |      2753    9.899617    .9660871   7.234177   15.19733
   lnpop30sq |      2753     98.9354    19.92003   52.33332   230.9587
    popdifsq |      2729    .0419716    .1519064   1.18e-09   5.376893
    agrshr20 |      2726    .5176248    .2391864          0          1
  agrshr20sq |      2726    .3251246    .2394089          0          1
-------------+--------------------------------------------------------
    agrshr30 |      2748    .4788808    .2314651          0          1
  agrshr30sq |      2748    .2828835    .2185237          0          1
  manufshr20 |      2726    .1177411    .1366018          0          1
  manufshr30 |      2753    .0852755    .1083223          0   1.042577
 nowage20dum |      2753    .0472212    .2121502          0          1
-------------+--------------------------------------------------------
 nowage30dum |      2753    .1514711    .3585726          0          1
    lnwage20 |      2753    1.437669     .609981         -1   2.730856
    lnwage30 |      2753    1.341375    1.041214         -1   2.620676
notwage30dum |      2753    .0526698     .223414          0          1
   lntwage30 |      2753    1.788536    .6821798         -1   2.398963
-------------+--------------------------------------------------------
     lnemp20 |      2726    8.795065    .9904395    4.61512    14.1185
     lnemp30 |      2753    8.885858    1.000913   6.322565   14.40485
  urbshare20 |      2729    .1965867     .239874          0          1
  urbshare30 |      2729    .2588364    .3293779          0   2.933782
   lnfaval20 |      2725    5.626822    .8245814   2.995732   9.012499
-------------+--------------------------------------------------------
   lnfaval30 |      2749     5.56359    .8182017   2.482908   10.30676
lnmedhsval30 |      2698    9.538795     .482174   8.073895   11.36807
  lnmedrnt30 |      2701    8.976066    .4468523   7.851218   10.34694
     white20 |      2729     .886071    .1866271   .0921502          1
   white20sq |      2729    .8199387    .2658852   .0084917          1
-------------+--------------------------------------------------------
     white30 |      2753    .8733239    .1864375   .1406302          1
   white30sq |      2753     .797441    .2695557   .0197768          1
     pctil20 |      2729    .0669382    .0749428   .0015806   .5655269
     pctil30 |      2753     .051089    .0560706   .0004784    .502906
    PRADIO30 |      2753    .2678364    .1768378          0      .7777
-------------+--------------------------------------------------------
     urate30 |      2753    .0272718    .0200298          0    .139693
     fbshr20 |      2729    .0749195    .0819557          0   .5354601
     fbshr30 |      2753    .0528107    .0609945          0    .320442

. 
. logit tva $X, cluster(state)

Iteration 0:   log pseudolikelihood = -620.56296  
Iteration 1:   log pseudolikelihood = -525.24169  
Iteration 2:   log pseudolikelihood = -362.61181  
Iteration 3:   log pseudolikelihood = -323.98305  
Iteration 4:   log pseudolikelihood = -311.03804  
Iteration 5:   log pseudolikelihood = -302.73942  
Iteration 6:   log pseudolikelihood = -296.51471  
Iteration 7:   log pseudolikelihood = -295.78566  
Iteration 8:   log pseudolikelihood = -295.77879  
Iteration 9:   log pseudolikelihood = -295.77879  

Logistic regression                               Number of obs   =       2650
                                                  Wald chi2(23)   =          .
                                                  Prob > chi2     =          .
Log pseudolikelihood = -295.77879                 Pseudo R2       =     0.5234

                                 (Std. Err. adjusted for 47 clusters in state)
------------------------------------------------------------------------------
             |               Robust
         tva |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   lnelevmax |   1.662994   .4950865     3.36   0.001      .692642    2.633345
  lnelevrang |  -.8196358   .3936486    -2.08   0.037    -1.591173   -.0480988
      lnarea |  -1.600095   .5394871    -2.97   0.003     -2.65747   -.5427195
     lnpop20 |  -39.03391   13.87545    -2.81   0.005    -66.22929   -11.83853
   lnpop20sq |   1.758054   .7497965     2.34   0.019     .2884795    3.227628
     lnpop30 |   18.77122   13.94366     1.35   0.178    -8.557847    46.10029
   lnpop30sq |  -.9325528   .7531994    -1.24   0.216    -2.408797    .5436909
    popdifsq |  -18.88518   2.532836    -7.46   0.000    -23.84944   -13.92091
    agrshr20 |  -6.874593   2.081977    -3.30   0.001    -10.95519   -2.793994
  agrshr20sq |   4.012696     1.5706     2.55   0.011     .9343764    7.091016
    agrshr30 |  -1.301907   2.037398    -0.64   0.523    -5.295134     2.69132
  agrshr30sq |   1.002188   1.100878     0.91   0.363    -1.155493    3.159868
  manufshr20 |  -1.751683   2.293276    -0.76   0.445    -6.246421    2.743055
  manufshr30 |  -3.476248   1.697725    -2.05   0.041    -6.803728   -.1487676
 nowage20dum |  -5.452644   2.404094    -2.27   0.023    -10.16458   -.7407061
 nowage30dum |   .3031196   1.578115     0.19   0.848     -2.78993    3.396169
    lnwage20 |   -1.16967   .6848632    -1.71   0.088    -2.511977    .1726368
    lnwage30 |   .1342359   .6382763     0.21   0.833    -1.116763    1.385234
notwage30dum |  -2.984976   1.543144    -1.93   0.053    -6.009483    .0395312
   lntwage30 |  -1.020015   .6164829    -1.65   0.098    -2.228299    .1882695
     lnemp20 |   .8063956   .8167089     0.99   0.323    -.7943244    2.407116
     lnemp30 |   5.061176   2.356482     2.15   0.032     .4425564    9.679795
  urbshare20 |  -2.590687   3.473012    -0.75   0.456    -9.397665    4.216291
  urbshare30 |   3.913726    2.58971     1.51   0.131    -1.162012    8.989464
   lnfaval20 |   -.216096   .7169448    -0.30   0.763    -1.621282     1.18909
   lnfaval30 |  -.4201545   1.087079    -0.39   0.699     -2.55079    1.710481
lnmedhsval30 |  -2.594033   .7385151    -3.51   0.000    -4.041496    -1.14657
  lnmedrnt30 |   3.286448   .7963622     4.13   0.000     1.725607    4.847289
     white20 |   47.34011   14.56238     3.25   0.001     18.79837    75.88185
   white20sq |   -39.1044   16.58583    -2.36   0.018    -71.61202   -6.596773
     white30 |  -48.11906   14.29015    -3.37   0.001    -76.12723   -20.11089
   white30sq |    41.2489   16.52822     2.50   0.013      8.85419    73.64361
     pctil20 |   .4198937   5.679439     0.07   0.941     -10.7116    11.55139
     pctil30 |   2.686404   9.096766     0.30   0.768    -15.14293    20.51574
    PRADIO30 |  -12.92824   4.940496    -2.62   0.009    -22.61143   -3.245042
     urate30 |   -52.3565   20.88351    -2.51   0.012    -93.28743   -11.42558
     fbshr20 |  -57.02758   51.54759    -1.11   0.269     -158.059    44.00384
     fbshr30 |   -197.195   95.37337    -2.07   0.039    -384.1234   -10.26665
       _cons |   77.20371   20.35749     3.79   0.000     37.30376    117.1037
------------------------------------------------------------------------------
Note: 1082 failures and 0 successes completely determined.

. predict phat
(option pr assumed; Pr(tva))
(103 missing values generated)

. replace phat = . if border_coun ==1 
(78 real changes made, 78 to missing)

. 
. keep if e(sample)==1
(103 observations deleted)

. 
. sum phat if tva==1, det

                           Pr(tva)
-------------------------------------------------------------
      Percentiles      Smallest
 1%     .0220013        .017093
 5%     .0616941       .0220013
10%     .1204448       .0342189       Obs                 163
25%     .2385735       .0406609       Sum of Wgt.         163

50%      .394553                      Mean           .4353689
                        Largest       Std. Dev.      .2512313
75%     .6489688       .9244217
90%     .7802524       .9419698       Variance       .0631172
95%     .8739863       .9451112       Skewness       .3145341
99%     .9451112       .9901465       Kurtosis       2.110171

. sum phat if tva==0, det

                           Pr(tva)
-------------------------------------------------------------
      Percentiles      Smallest
 1%     6.76e-30              0
 5%     8.56e-24              0
10%     8.54e-20       3.16e-37       Obs                2409
25%     2.01e-14       1.36e-36       Sum of Wgt.        2409

50%     5.17e-07                      Mean           .0305759
                        Largest       Std. Dev.      .0921552
75%     .0059611       .7177036
90%     .0856774       .7327895       Variance       .0084926
95%     .1962391       .7342087       Skewness       4.390026
99%     .4886943       .8877811       Kurtosis       25.21635

. local cut=r(p25)

. 
. tab tva

        tva |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      2,484       93.74       93.74
          1 |        166        6.26      100.00
------------+-----------------------------------
      Total |      2,650      100.00

. 
. preserve

. drop if phat<`cut'&tva==0
(603 observations deleted)

. **Construct O-B weights**
. 
. mata: D=st_data(.,"tva")

. mata: one=J(rows(D),1,1)

. mata: nD=one-D

. order $X

. local K:word count $X

. mata: X=st_data(.,1..`K')

. mata: X=(one, X)

. mata: w=D'*X*invsym(quadcross(X,nD,X))*X'/sum(D)

. mata: w=w':*nD

. gen w=.
(2047 missing values generated)

. mata: st_store(.,"w",w)

. 
. replace w=1 if tva==1
(166 real changes made)

. sum w if tva==0

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
           w |      1881    .0005316    .0009938  -.0027702   .0038108

. sum w if tva==1

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
           w |       166           1           0          1          1

. 
. 
. restore

. gen w=1 //weights

. 
. 
. 
. 
. 
. drop if phat<`cut'
(603 observations deleted)

. 
. 
. 
. local i=1

. foreach var in lnpop lnemp lnhouse lnwage manufshr agrshr lnfaval{      
  2.         g  Dy = (`var'40-`var'0)/4
  3. 
.         qui centile Dy, c(1 99)
  4.         qui replace Dy=r(c_1) if Dy<r(c_1)
  5.         qui replace Dy=r(c_2) if Dy>r(c_2)&Dy!=.
  6. 
.         qui reg Dy tva, cluster(state) 
  7.         eststo base`i'
  8.         qui x_ols Dy $X, cluster(state) bo(tva)
  9.         eststo eval`i'
 10.         qui x_ols Dy $X, lat(latitude) long(longitud) cut1(200) cut2(200) 
> bo(tva)
 11.         eststo cor_eval`i'
 12.         drop Dy 
 13.         local ++i
 14. }
(139 missing values generated)
(139 missing values generated)
(139 missing values generated)
(548 missing values generated)
(140 missing values generated)
(140 missing values generated)
(172 missing values generated)

. 
. 
. 
. 
. 
. 
. local i=1

. foreach var in lnpop lnemp lnhouse lnwage manufshr agrshr lnfaval{      
  2.         g  Dy = (`var'40-`var'0)/4
  3. 
.         qui centile Dy, c(1 99)
  4.         qui replace Dy=r(c_1) if Dy<r(c_1)
  5.         qui replace Dy=r(c_2) if Dy>r(c_2)&Dy!=.
  6. 
.         qui x_ols Dy tva if south==1, lat(latitude) long(longitud) cut1(200) 
> cut2(200)
  7.         eststo base`i', title(`var')
  8.         qui x_ols Dy $X if south==1, lat(latitude) long(longitud) cut1(200
> ) cut2(200) bo(tva)
  9.         eststo cor_eval`i', title(`var')
 10.         drop Dy 
 11.         local ++i
 12. }
(139 missing values generated)
(139 missing values generated)
(139 missing values generated)
(548 missing values generated)
(140 missing values generated)
(140 missing values generated)
(172 missing values generated)

. 
. 
. 
. 
. ******************************
. *****************************
. *****************************
. ******************************
. 
. 
. replace border1 = 0 if border1 ==.
(1969 real changes made)

. replace border2 = 0 if border2 ==.
(1822 real changes made)

. summ fips border* tva

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
        fips |      2047    29229.92    14655.12       1001      56045
border_cou~y |        78           1           0          1          1
     border2 |      2047     .109917    .3128626          0          1
     border1 |      2047    .0381045    .1914954          0          1
         tva |      2047    .0810943    .2730466          0          1

. tab border_county border1

border_cou |  border1
       nty |         1 |     Total
-----------+-----------+----------
         1 |        78 |        78 
-----------+-----------+----------
     Total |        78 |        78 


. tab tva border1

           |        border1
       tva |         0          1 |     Total
-----------+----------------------+----------
         0 |     1,806         75 |     1,881 
         1 |       163          3 |       166 
-----------+----------------------+----------
     Total |     1,969         78 |     2,047 


. tab tva border2

           |    (mean) border2
       tva |         0          1 |     Total
-----------+----------------------+----------
         0 |     1,727        154 |     1,881 
         1 |        95         71 |       166 
-----------+----------------------+----------
     Total |     1,822        225 |     2,047 


. * some of the border2 counties are within tva
. replace border2 = 0 if tva ==1
(71 real changes made)

. tab border1

    border1 |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,969       96.19       96.19
          1 |         78        3.81      100.00
------------+-----------------------------------
      Total |      2,047      100.00

. tab border2

     (mean) |
    border2 |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,893       92.48       92.48
          1 |        154        7.52      100.00
------------+-----------------------------------
      Total |      2,047      100.00

. drop if tva ==1
(166 observations deleted)

. drop tva

. rename border2 tva

. 
. local i=1

. foreach var in lnpop lnemp lnwage lnprodwage lntwage lnagr lnmanuf lnother ln
> vfprod lnmedfaminc lnfaval lnmedhsval lnmedrnt manufshr agrshr{
  2.         
.         if "`var'"=="lnmedfaminc"{
  3.                 g Dy=(`var'2000-`var'50)/5
  4.         }
  5.         else{
  6.                 g  Dy = (`var'2000-`var'40)/6
  7.         }
  8. 
.         qui centile Dy, c(1 99)
  9.         qui replace Dy=r(c_1) if Dy<r(c_1)
 10.         qui replace Dy=r(c_2) if Dy>r(c_2)&Dy!=.
 11. 
.         qui reg Dy tva, cluster(state) 
 12.         eststo base`i', title(`var')
 13.         qui x_ols Dy $X, cluster(state) bo(tva)
 14.         eststo eval`i', title(`var')
 15.         qui x_ols Dy $X, lat(latitude) long(longitud) cut1(200) cut2(200) 
> bo(tva)
 16.         eststo cor_eval`i', title(`var')
 17.         drop Dy 
 18.         local ++i
 19. }
(1 missing value generated)
(780 missing values generated)
(948 missing values generated)
(85 missing values generated)
(2 missing values generated)
(4 missing values generated)
(4 missing values generated)
(1 missing value generated)
(2 missing values generated)
(3 missing values generated)
(1 missing value generated)
(1 missing value generated)

. 
. 
. esttab base* using base2.csv, replace keep(tva) mlabels(lnpop lnemp lnwage ln
> prodwage lntwage lnagr lnmanuf lnother  lnvfprod lnmedfaminc lnfaval lnmedhsv
> al lnmedrnt manufshr agrshr) b(3) se(3) star(* 0.1 ** 0.05 *** 0.01)
(note: file base2.csv not found)
(output written to base2.csv)

. esttab eval* using eval2.csv, replace keep(tva) mlabels(lnpop lnemp lnwage ln
> prodwage lntwage lnagr lnmanuf lnother  lnvfprod lnmedfaminc lnfaval lnmedhsv
> al lnmedrnt manufshr agrshr) b(3) se(3) star(* 0.1 ** 0.05 *** 0.01)
(note: file eval2.csv not found)
(output written to eval2.csv)

. esttab cor_* using cor2.csv, replace keep(tva) mlabels(lnpop lnemp lnwage lnp
> rodwage lntwage lnagr lnmanuf lnother  lnvfprod lnmedfaminc lnfaval lnmedhsva
> l lnmedrnt manufshr agrshr) b(3) se(3) star(* 0.1 ** 0.05 *** 0.01)
(note: file cor2.csv not found)
(output written to cor2.csv)

. 
. 
. 
. 
. 
. 
end of do-file
